home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / umddvi / lib / dviclass.c < prev    next >
C/C++ Source or Header  |  1990-10-01  |  3KB  |  97 lines

  1. /*
  2.  * Copyright (c) 1987 University of Maryland Department of Computer Science.
  3.  * All rights reserved.  Permission to copy for any purpose is hereby granted
  4.  * so long as this copyright notice remains intact.
  5.  */
  6.  
  7. #ifndef lint
  8. static char rcsid[] = "$Header: dviclass.c,v 2.3 87/06/16 18:27:42 chris Exp $";
  9. #endif
  10.  
  11. /*
  12.  * dviclass - DVI code classification tables.
  13.  */
  14.  
  15. #include "dviclass.h"
  16.  
  17. /* shorthand---in lowercase for contrast (read on!) */
  18. #define    four(x)        x, x, x, x
  19. #define    six(x)        four(x), x, x
  20. #define    sixteen(x)    four(x), four(x), four(x), four(x)
  21. #define    sixty_four(x)    sixteen(x), sixteen(x), sixteen(x), sixteen(x)
  22. #define    one_twenty_eight(x)    sixty_four(x), sixty_four(x)
  23.  
  24. /*
  25.  * This table contains the byte length of the single operand, or DPL_NONE
  26.  * if no operand, or if it cannot be decoded this way.
  27.  *
  28.  * The sequences UNS1, UNS2, UNS3, SGN4 (`SEQ_U') and SGN1, SGN2, SGN3,
  29.  * SGN4 (`SEQ_S') are rather common, and so we define macros for these.
  30.  */
  31. #define    SEQ_U    DPL_UNS1, DPL_UNS2, DPL_UNS3, DPL_SGN4
  32. #define    SEQ_S    DPL_SGN1, DPL_SGN2, DPL_SGN3, DPL_SGN4
  33.  
  34. char dvi_oplen[256] = {
  35.     one_twenty_eight(DPL_NONE),
  36.                 /* characters 0 through 127 */
  37.     SEQ_U,            /* DVI_SET1 through DVI_SET4 */
  38.     DPL_NONE,        /* DVI_SETRULE */
  39.     SEQ_U,            /* DVI_PUT1 through DVI_PUT4 */
  40.     DPL_NONE,        /* DVI_PUTRULE */
  41.     DPL_NONE,        /* DVI_NOP */
  42.     DPL_NONE,        /* DVI_BOP */
  43.     DPL_NONE,        /* DVI_EOP */
  44.     DPL_NONE,        /* DVI_PUSH */
  45.     DPL_NONE,        /* DVI_POP */
  46.     SEQ_S,            /* DVI_RIGHT1 through DVI_RIGHT4 */
  47.     DPL_NONE,        /* DVI_W0 */
  48.     SEQ_S,            /* DVI_W1 through DVI_W4 */
  49.     DPL_NONE,        /* DVI_X0 */
  50.     SEQ_S,            /* DVI_X1 through DVI_X4 */
  51.     SEQ_S,            /* DVI_DOWN1 through DVI_DOWN4 */
  52.     DPL_NONE,        /* DVI_Y0 */
  53.     SEQ_S,            /* DVI_Y1 through DVI_Y4 */
  54.     DPL_NONE,        /* DVI_Z0 */
  55.     SEQ_S,            /* DVI_Z1 through DVI_Z4 */
  56.     sixty_four(DPL_NONE),    /* DVI_FNTNUM0 through DVI_FNTNUM63 */
  57.     SEQ_U,            /* DVI_FNT1 through DVI_FNT4 */
  58.     SEQ_U,            /* DVI_XXX1 through DVI_XXX4 */
  59.     SEQ_U,            /* DVI_FNTDEF1 through DVI_FNTDEF4 */
  60.     DPL_NONE,        /* DVI_PRE */
  61.     DPL_NONE,        /* DVI_POST */
  62.     DPL_NONE,        /* DVI_POSTPOST */
  63.     six(DPL_NONE)        /* 250 through 255 */
  64. };
  65.  
  66. char dvi_dt[256] = {
  67.     one_twenty_eight(DT_CHAR),
  68.                 /* characters 0 through 127 */
  69.     four(DT_SET),        /* DVI_SET1 through DVI_SET4 */
  70.     DT_SETRULE,        /* DVI_SETRULE */
  71.     four(DT_PUT),        /* DVI_PUT1 through DVI_PUT4 */
  72.     DT_PUTRULE,        /* DVI_PUTRULE */
  73.     DT_NOP,            /* DVI_NOP */
  74.     DT_BOP,            /* DVI_BOP */
  75.     DT_EOP,            /* DVI_EOP */
  76.     DT_PUSH,        /* DVI_PUSH */
  77.     DT_POP,            /* DVI_POP */
  78.     four(DT_RIGHT),        /* DVI_RIGHT1 through DVI_RIGHT4 */
  79.     DT_W0,            /* DVI_W0 */
  80.     four(DT_W),        /* DVI_W1 through DVI_W4 */
  81.     DT_X0,            /* DVI_X0 */
  82.     four(DT_X),        /* DVI_X1 through DVI_X4 */
  83.     four(DT_DOWN),        /* DVI_DOWN1 through DVI_DOWN4 */
  84.     DT_Y0,            /* DVI_Y0 */
  85.     four(DT_Y),        /* DVI_Y1 through DVI_Y4 */
  86.     DT_Z0,            /* DVI_Z0 */
  87.     four(DT_Z),        /* DVI_Z1 through DVI_Z4 */
  88.     sixty_four(DT_FNTNUM),    /* DVI_FNTNUM0 through DVI_FNTNUM63 */
  89.     four(DT_FNT),        /* DVI_FNT1 through DVI_FNT4 */
  90.     four(DT_XXX),        /* DVI_XXX1 through DVI_XXX4 */
  91.     four(DT_FNTDEF),    /* DVI_FNTDEF1 through DVI_FNTDEF4 */
  92.     DT_PRE,            /* DVI_PRE */
  93.     DT_POST,        /* DVI_POST */
  94.     DT_POSTPOST,        /* DVI_POSTPOST */
  95.     six(DT_UNDEF)        /* 250 through 255 */
  96. };
  97.